<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
		<link rel="stylesheet" type="text/css" href="__STATIC__/static/h-ui/css/H-ui.min.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/static/h-ui.admin/css/H-ui.admin.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/lib/Hui-iconfont/1.0.8/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/static/h-ui.admin/skin/default/skin.css" id="skin" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/static/h-ui.admin/css/style.css" />
		<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
		<title>添加管理员 - 管理员管理 - H-ui.admin v3.1</title>
		<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
		<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
		<style>
			.formControls select{
                border: 1px solid skyblue;
                outline: none;
                width: 80px;
                height: 20px;
                line-height: 20px;
                text-align: center;
			}
			#houseaddress{
				margin-left: 20px;
				font-size: 12px;
				border: 1px solid skyblue;
			}
			img{
				width: 45px;
				height: 45px;
			}
			#imgs img{
				margin-right: 10px;
			}
		</style>
	</head>

	<body>
		<article class="page-container">
			<form class="form form-horizontal" id="updates">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源ID：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.id}" readonly="readonly" name="house_id" id="house_id">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源编号：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.house_num}" readonly="readonly" name="house_num" id="house_num">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源标题：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.house_title}" name="house_title" id="house_title">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源简介：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.house_intro}" name="house_intro" id="house_intro">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源每平方米单价：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="单位：元/㎡.月" value="{$result.house_unitprice}" id="house_unitprice" name="house_unitprice">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源总价：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="单位：元/月" value="{$result.house_totalprices}" id="house_totalprices" name="house_totalprices">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源主图片：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<img src="../../../public/uploads/{$result.house_smallimg}.jpg">
						<input type="file" class="input-text" name="house_smallimg">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源图片：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span id="imgsspan" hidden="hidden">{$result.house_bigimg}</span>
						<div id="imgs"></div>
						<input type="file" class="input-text" id="file1" name="fileimg[]">
						<input type="file" class="input-text" id="file2" name="fileimg[]">
						<input type="file" class="input-text" id="file3" name="fileimg[]">
						<input type="file" class="input-text" id="file4" name="fileimg[]">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源占地面积：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="单位：㎡" value="{$result.house_floorspace}" name="house_floorspace" id="house_floorspace">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源装修程度：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="house_fitment" value="{$result.house_fitment}" id="house_fitment">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">可注册：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<div class="radio-box">
							<input name="sex" type="radio" id="sex-1" value="可注册">
							<label for="sex-1">是</label>
						</div>
						<div class="radio-box">
							<input type="radio" id="sex-2" value="不可注册" name="sex">
							<label for="sex-2">否</label>
						</div>
						<input type="text" hidden="hidden" value="{$result.house_isres}" id='house_isres' name="house_isres" />
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">免租时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="面议" value="{$result.house_freetime}" id="house_freetime" name="house_freetime">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">最早可租：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" id="house_earliest" value="{$result.house_earliest}" name="house_earliest">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>最短租期：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="单位：月" value="{$result.house_shortest}" id="house_shortest" name="house_shortest">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>面积信息：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" id="house_aareainfo" value="{$result.house_aareainfo}" name="house_aareainfo">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">价格优势：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" id="house_priceadv" value="{$result.house_priceadv}" name="house_priceadv">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>装修程度详情：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="house_fitmentinfo" value="{$result.house_fitmentinfo}" id="house_fitmentinfo">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">看房时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="联系顾问，随时可看" value="{$result.house_looktime}" id="house_looktime" name="house_looktime">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源地段：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<select name="province" id="province">
							<option></option>
						</select>
						<select name="city" id="city">
							<option></option>
						</select>
						<span id="houseaddress">{$result.house_district}</span>
						<input type="text" hidden="hidden" value='{$result.house_district}' id='houseaddress' name="house_district" />
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源详细地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="house_detailedaddress" value="{$result.house_detailedaddress}" id="house_detailedaddress">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">到地铁的时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="house_metro" value="{$result.house_metro}" id="house_metro">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>房源类型：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<select id='house_type'>
							{volist name="type" id='item'}
								<option>{$item.type_content}</option>
							{/volist}
						</select>
						<input type="text" hidden="hidden" value="{$result.house_type}" name="house_type" />
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">房源品牌：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.house_brand}" name="house_brand" id="house_brand">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">房源特色：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$result.house_feature}" name="house_feature" id="house_feature">
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
						<input id='insertbtn' class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;修改&nbsp;&nbsp;">
					</div>
				</div>
			</form>
		</article>

		<!--_footer 作为公共模版分离出去-->
		<script type="text/javascript" src="__STATIC__/lib/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript" src="__STATIC__/lib/layer/2.4/layer.js"></script>
		<script type="text/javascript" src="__STATIC__/static/h-ui/js/H-ui.min.js"></script>
		<script type="text/javascript" src="__STATIC__/static/h-ui.admin/js/H-ui.admin.js"></script>
		<!--/_footer 作为公共模版分离出去-->

		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
		<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
		<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
		<script type="text/javascript">
			$(function() {
				var imgStr = $('#imgsspan').text();
				var imgArr = imgStr.split(",");
				var imgpath = '';
				for(var i=0;i<imgArr.length;i++){
					imgpath+="<img src='../../../public/uploads/"+imgArr[i]+"' />";
				}
				$('#imgs').append(imgpath);
				
				var arr_province = ['全重庆', '渝中', '江北', '渝北'];
				var arr_city = [
					['菜园坝', '大坪', '太溪沟', '化龙桥', '解放碑', '两路口', '七星岗', '上清寺', '渝中其他', '朝天门', '江北1', '江北2', '江北3', '江北4', '江北5', '江北6', '江北7', '江北8', '江北9', '江北10', '江北11', '渝北1', '渝北2', '渝北3', '渝北4', '渝北5', '渝北6', '渝北7', '渝北8', '渝北9', '渝北10', '渝北11'],
					['菜园坝', '大坪', '太溪沟', '化龙桥', '解放碑', '两路口', '七星岗', '上清寺', '渝中其他', '朝天门'],
					['江北1', '江北2', '江北3', '江北4', '江北5', '江北6', '江北7', '江北8', '江北9', '江北10', '江北11'],
					['渝北1', '渝北2', '渝北3', '渝北4', '渝北5', '渝北6', '渝北7', '渝北8', '渝北9', '渝北10', '渝北11']
				];
				/*数据加载时....*/
				var isres = $('#house_isres').val();
				if(isres == '可注册') {
					$('#sex-1').attr('checked', 'checked');
				} else {
					$('#sex-2').attr('checked', 'checked');
				}
				/*加载类型时*/
				var hosetype = $('input[name=house_type]').val();
				document.getElementById("house_type")[hosetype].selected=true;
//				document.getElementById('house_type').options[hosetype].attr('checked','checked');
				
				
				/*数据加载放地段*/
				var house_district = $('#houseaddress').text();
				var house_district_arr = [];
				house_district_arr.push(house_district.split('-'));

				//首先获取对象
				var province = document.getElementById('province');
				var city = document.getElementById('city');
				//指定省份中<option>标记的个数
				province.length = arr_province.length;
				//循环将数组中的数据写入<option>标记中
				for(var i = 0; i < arr_province.length; i++) {
					province.options[i].text = arr_province[i];
					province.options[i].value = arr_province[i];
				}
				//修改省份列表的默认选择项
				var index = 0;
				province.selectedIndex = index;
				//指定城市中<option>标记的个数
				city.length = arr_city[index].length;
				//循环将数组中的数据写入<option>标记中
				for(var j = 0; j < arr_city[index].length; j++) {
					city.options[j].text = arr_city[index][j];
					city.options[j].value = arr_city[index][j];
				}
				document.getElementById('province').options[0].text = house_district_arr[0][0];
				document.getElementById('province').options[0].value = house_district_arr[0][0];
				document.getElementById('city').options[0].text = house_district_arr[0][1];
				document.getElementById('city').options[0].value = house_district_arr[0][1];
				var str = '';
				var index = 0;
				$('#province').change(function() {
					index = this.selectedIndex;
					//选择对象
					var city = document.getElementById('city');
					//修改省份列表的选择项
					province.selectedIndex = index;
					//指定城市中<option>标记的个数
					city.length = arr_city[index].length;
					//循环将数组中的数据写入<option>标记中
					for(var j = 0; j < arr_city[index].length; j++) {
						city.options[j].text = arr_city[index][j];
						city.options[j].value = arr_city[index][j];
					}
				});
				$('#city').change(function() {
					var indexs = this.selectedIndex;
					str = arr_province[index] + '-' + arr_city[index][indexs];
					$('#houseaddress').text(str);
					$('input[name=house_district]').val(str);
				});
				/*房源类型*/
				$('#house_type').change(function(){
					$('input[name=house_type]').val($(this).val());
				});
				/*是否可注册*/
				$('input[name=sex]').click(function(){
					$('input[name=house_isres]').val($(this).val());
					console.log($('input[name=house_isres]').val())
				});
/*************************************************************************************************/
				$('.skin-minimal input').iCheck({
					checkboxClass: 'icheckbox-blue',
					radioClass: 'iradio-blue',
					increaseArea: '20%'
				});

				$("#updates").validate({
					onkeyup: false,
					focusCleanup: true,
					success: "valid",
					submitHandler: function(form) {
						$(form).ajaxSubmit({
							type: 'post',
							url: "houseupdate",
							success: function(data) {
								if(data==1){
									location.href='http://118.24.83.96:80/wojuAdmin/public/admin/house/index';
								}
							}
						});
						
					}
				});
			});
		</script>
	</body>

</html>